package org.devgframwork.flowsystem.api.admin.user.controller;

import org.devgframwork.flowsystem.api.admin.user.entity.vo.UserVo;
import org.devgframwork.flowsystem.api.admin.user.service.UserService;
import org.devgframwork.platform.model.ResultModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author duheng
 * @Date 2021/11/13 17:04
 */
@Api(value = "/api/admin/user", tags = "用户管理")
@Slf4j
@RestController
public class AdminUserController {

    @Resource
    private UserService userService;

    @ApiOperation("用户登录")
    @PostMapping(value = {"/api/admin/user/login"})
    public ResultModel login(@Validated UserVo userVo) {
        return userService.login(userVo);
    }

    @ApiOperation("校验测试")
    @PostMapping(value = {"/api/admin/user/validated"})
    public ResultModel validated(@Validated UserVo userVo) {
        return ResultModel.newSuccess();
    }
}
